package com.dayuanit.dy15.lesson21.demo1;

public class Test {
    public static void main(String[] args) {
        int num = 9;

        System.out.println(num);

        Integer integer = new Integer(6);
        System.out.println(integer);
        System.out.println(integer.toString());

        System.out.println( Integer.toBinaryString(6));
        System.out.println( Integer.toHexString(36));

        int num2 = 8;
        num2 = integer;//拆箱操作 jdk1.5
        num2 = integer.intValue();//面试的时候会经常问  装箱拆箱的底层实现
        System.out.println("num2=" + num2);

        Integer num3 = new Integer(7);
        num3 = 9;//装箱操作
        num3 = Integer.valueOf(9);

        String str = "100";
        int num4 = Integer.parseInt(str);//将字符串转成数字
        System.out.println(num4);

        Integer integer2 = new Integer(str);
        System.out.println(integer2);

        System.out.println(Integer.MAX_VALUE);
        System.out.println(Integer.MIN_VALUE);

        //int -> Integer
        //boolean -> Booolean

        System.out.println("-------------------");

//        Integer integer3 = new Integer(20);
//        Integer integer4 = new Integer(20);
//
//        Integer integer5 = 300;//
////        Integer.valueOf(300);
//        Integer integer6 = 300;
//        System.out.println(integer3 == integer4);//false
//        System.out.println(integer5 == integer6);//false
//        System.out.println(integer5.equals(integer6));//true
//
//        int num7 = 300;
//        System.out.println(num7 == integer6);//true  自动拆箱为int，然后int和int进行比较
//        System.out.println(integer6 == num7);//true

        Integer integer7 = 20;
        Integer integer8 = 20;

        Integer integer9 = 127;
        Integer integer10 = Integer.valueOf(127);

        System.out.println(integer7.equals(integer8));//true
        System.out.println(integer7 == integer8);//true
        System.out.println(integer9 == integer10);//false

    }
}
